package com.estasenposse.tdam.ui;

import com.estasenposse.tdam.bd.DatabaseHandler;
import com.estasenposse.tdam.entities.Noticia;
import com.estasenposse.tdam.entities.Publicity;
import com.estasenposse.tdam.ui.adapter.ImageDownloader;
import com.example.estasenposse.R;
import com.example.estasenposse.R.layout;
import com.example.estasenposse.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.TextView;

public class Publicity_activity extends Activity {
	
	private static TextView txt_name;
	private static TextView txt_adress;
	private static TextView txt_mail;
	private static TextView txt_telephone;
	private static TextView txt_link;
	private static ImageView picture;
	

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_publicity_activity);
		
		DatabaseHandler db = new DatabaseHandler(getApplicationContext());
		Bundle bundle = getIntent().getExtras();
		Integer aux = bundle.getInt("ID");
		Publicity publi = db.getPublicity(aux);
		
		txt_name = (TextView) findViewById(R.id.txt_publicity_name);
		txt_adress = (TextView) findViewById(R.id.txt_publicity_adress);
		txt_mail = (TextView) findViewById(R.id.txt_publicity_mail);
		txt_telephone = (TextView) findViewById(R.id.txt_publicity_phone);
		txt_link = (TextView) findViewById(R.id.txt_publicity_web);
		picture = (ImageView) findViewById(R.id.iv_publicity_image);
		
		txt_name.setText(publi.getName());
		txt_adress.setText(publi.getAdress());
		txt_mail.setText(publi.getMail());
		txt_telephone.setText(publi.getTelephone());
		txt_link.setText(publi.getLink());
		
		String url = publi.getPicture();
		
		ImageDownloader downloader = new ImageDownloader(picture, null);
		downloader.execute(url);
		
	}

}
